package com.kunya.product.dao;

import com.kunya.product.po.Address;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface AddressMapper {
    int deleteByPrimaryKey(@Param("addressId")Long addressId,@Param("table_prefix") String table_prefix);

    int insert(@Param("address")Address address,@Param("table_prefix") String table_prefix);
    //新增收货地址
    int insertSelective(@Param("address")Address address,@Param("table_prefix") String table_prefix);

    Address selectByPrimaryKey(@Param("addressId")Long addressId,@Param("table_prefix") String table_prefix);
    //编辑收货地址
    int updateByPrimaryKeySelective(@Param("address")Address address,@Param("table_prefix") String table_prefix);

    int updateByPrimaryKey(@Param("address")Address address,@Param("table_prefix") String table_prefix);
    //根据用户id查询收货地址列表
    List<Address> selectAddressListByUserId(@Param("userId") Long userId,@Param("table_prefix") String tablePrefix);
    //根据收货地址id和用户id查询收货地址详情
    Address selectAddress(@Param("addressId") Long addressId,@Param("userId") Long userId,@Param("table_prefix") String tablePrefix);

    //设置默认收货地址
    int setDefaultAddress(@Param("userId") Long userId,@Param("addressId")Long addressId,@Param("defaults") Boolean defaults,@Param("table_prefix") String table_prefix);
}